package com.cy.pj.sys.service.impl;

import com.cy.pj.common.pojo.Node;
import com.cy.pj.sys.dao.SysMenuDao;
import com.cy.pj.sys.pojo.SysMenu;
import com.cy.pj.sys.service.SysMenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysMenuServiceImpl implements SysMenuService {

    @Resource
    private SysMenuDao sysMenuDao;

    @Override
    public List<SysMenu> findMenus() {
        List<SysMenu> sysMenus = sysMenuDao.selectMenus();
        return sysMenus;
    }

    @Override
    public List<Node> findMenuTreeNodes() {
        List<Node> nodes = sysMenuDao.selectMenuTreeNodes();
        return nodes;
    }

    @Override
    public int saveMenu(SysMenu sysMenu) {
        int i = sysMenuDao.insertMenu(sysMenu);
        return i;
    }

    @Override
    public int updateMenu(SysMenu sysMenu) {
        int i = sysMenuDao.updateMenu(sysMenu);
        return i;
    }
}
